View Javadoc
1 /* 2 * Title: S/MIME Project 3 * Description: S/MIME email sending capabilities 4 * @Author Vladimir Radisic 5 * @Version 2.0.1 6 */ 7 8 package org.webdocwf.util.smime.der; 9 10 11 import org.webdocwf.util.smime.exception.SMIMEException; 12 13 14 /*** 15 * DERClassContextSpecificPr can be both, primitive or structured type of DER 16 * encoded object with the context-specific class tag (part of object Identifier 17 * Octet) in ASN.1 notation. Difference bettween DERClassContextSpecific and 18 * DERClassContextSpecificPr is that class DERClassContextSpecific has public 19 * method addContent. Also, DERClassContextSpecific extends it's super class 20 * DERClassContextSpecificPr. 21 */ 22 public class DERClassContextSpecificPr extends DERObject { 23 24 /*** 25 * Identifies if DERClassContextSpecificPr represents primitive or structured 26 * DER object. 27 */ 28 private boolean structureIdentificator = false; 29 30 /*** 31 * Counter for objects added to DERClassContextSpecificPr. Couldn't be more than 32 * 1 for primitive DERClassContextSpecificPr 33 */ 34 private int countOfAddings = 0; 35 36 /*** 37 * Constructs the structured or primitive DERClassContextSpecificPr object 38 * @param type0 define value of identifier octet 39 * @param structured0 used for defining structured complexity of Context Specific 40 * class (true = structured, and false = primitive) 41 * @exception SMIMEException thrown in super class constructor. 42 */ 43 public DERClassContextSpecificPr(int type0, boolean structured0) throws SMIMEException { 44 super(structured0 ? (type0 | 160) : (type0 | 128)); 45 structureIdentificator = structured0; 46 } 47 48 /*** 49 * Adds content to DER encoded Context Specific Class Type 50 * @param content0 content for adding to Context Specific Class Type 51 * @exception SMIMEException when adding content to primitive 52 * DERClassContextSpecificPr object is performed more than once, or thrown in 53 * super class method addContent. 54 */ 55 protected void addContent(byte[] content0) throws SMIMEException { 56 if (structureIdentificator == false & countOfAddings > 0) 57 throw new SMIMEException(this, 1005); 58 super.addContent(content0); 59 countOfAddings++; 60 } 61 } 62

This page was automatically generated by Maven